//
//  EventDetailAPIRequest.m
//  ConvenientlyTake
//
//  Created by 森鑫 on 2022/12/23.
//

#import "EventDetailAPIRequest.h"

@implementation EventDetailAPIRequest

+(NSURLSessionDataTask *)GETEventDetailsWithEventId:(NSString *)eventId
                                            success:(LZTResponseSuccess)success
                                               fail:(LZTResponseFailure)fail {
//    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
//    [parameters setValue:eventId forKey:@"eventId"];
//    return [self GETWithURLString:@"/api/app/event/getEventDetails" parameters:parameters success:success failure:fail];
    NSString *url = [NSString stringWithFormat:@"/api/m/event/getEventDetails/%@" , eventId];
    return [self GETWithURLString:url parameters:nil success:success failure:fail];
}

//
+(NSURLSessionDataTask *)GETEventLogWithEventId:(NSString *)eventId
                                            success:(LZTResponseSuccess)success
                                               fail:(LZTResponseFailure)fail {
//    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
//    [parameters setValue:eventId forKey:@"eventId"];
    NSString *url = [NSString stringWithFormat:@"/api/public/event-log/findByEventId/%@" , eventId];
    return [self GETWithURLString:url parameters:nil success:success failure:fail];
}

+(NSURLSessionDataTask *)GETEventfindUserListByPage:(NSInteger)page
                                           pageSize:(NSInteger)pageSize
                                             deptId:(NSString *)deptId
                                            success:(LZTResponseSuccess)success
                                               fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:@(page) forKey:@"page"];
    [parameters setValue:@(pageSize) forKey:@"pageSize"];
    if (deptId) {
        [parameters setValue:deptId forKey:@"deptId"];
    }
    return [self GETWithURLString:@"/api/public/user-affiliation/findUserListByPage" parameters:parameters success:success failure:fail];
}



+(NSURLSessionDataTask *)POSTWorkingAuditApprovehAuditTaskId:(NSString *)auditTaskId
                                                  disposalDesc:(NSString *)disposalDesc
                                                    imagesList:(NSArray *)imagesList
                                                        success:(LZTResponseSuccess)success
                                                          fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(auditTaskId) forKey:@"auditTaskId"];
    if (disposalDesc){
        [parameters setObject:R(disposalDesc) forKey:@"disposalDesc"];
    }
    if(imagesList.count){
        [parameters setObject:R(imagesList) forKey:@"imagesList"];
    }
    return [self POSTWithURLString:@"/api/public/event-process/audit/approve" parameters:parameters success:success failure:fail];
}


+(NSURLSessionDataTask *)POSTworkingAssignRejectWithEventId:(NSString *)eventId
                                                              rejectionReason:(NSString *)rejectionReason
                                                                      success:(LZTResponseSuccess)success
                                                                         fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(eventId) forKey:@"eventId"];
    [parameters setObject:R(rejectionReason) forKey:@"rejectionReason"];
    return [self POSTWithURLString:@"/api/public/event-process/assign/reject" parameters:parameters success:success failure:fail];
}

+(NSURLSessionDataTask *)POSTWorkingAuditRejectWithAuditTaskId:(NSString *)eventId
                                                                       rejectionReason:(NSString *)rejectionReason
                                                                               success:(LZTResponseSuccess)success
                                                                                  fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(eventId) forKey:@"auditTaskId"];
    [parameters setObject:R(rejectionReason) forKey:@"rejectionReason"];
    return [self POSTWithURLString:@"/api/public/event-process/audit/reject" parameters:parameters success:success failure:fail];
}

+(NSURLSessionDataTask *)POSTWorkingDisposalSaveWithEventId:(NSString *)eventId
                                                disposalDesc:(NSString *)disposalDesc
                                                  imagesList:(NSArray *)imagesList
                                                     success:(LZTResponseSuccess)success
                                                        fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(eventId) forKey:@"eventId"];
    if (disposalDesc){
        [parameters setObject:R(disposalDesc) forKey:@"disposalDesc"];
    }
    if(imagesList.count){
        [parameters setObject:R(imagesList) forKey:@"imagesList"];
    }
    return [self POSTWithURLString:@"/api/public/event-process/disposal/save" parameters:parameters success:success failure:fail];
}

+(NSURLSessionDataTask *)POSTWorkingDisposalSubmmitWithEventId:(NSString *)eventId
                                                    disposalDesc:(NSString *)disposalDesc
                                                      imagesList:(NSArray *)imagesList
                                                         success:(LZTResponseSuccess)success
                                                            fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(eventId) forKey:@"eventId"];
    if (disposalDesc){
        [parameters setObject:R(disposalDesc) forKey:@"disposalDesc"];
    }
    if(imagesList.count){
        [parameters setObject:R(imagesList) forKey:@"imagesList"];
    }
    return [self POSTWithURLString:@"/api/public/event-process/disposal/submit" parameters:parameters success:success failure:fail];
}

+ (NSURLSessionDataTask *)GETEnableAssignDepartmentSuccess:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail{
    return [self GETWithURLString:@"/api/public/department/getEnableAssignDepartment" parameters:nil success:success failure:fail];
}

+(NSURLSessionDataTask *)POSTWorkingAssignToUserWithAssignTaskId:(NSString *)assignTaskId
                                                          userId:(NSString *)userId
                                   requiredDisposeCompletionTime:(NSString *)requiredDisposeCompletionTime
                                                         success:(LZTResponseSuccess)success
                                                            fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(assignTaskId) forKey:@"assignTaskId"];
    [parameters setObject:R(userId) forKey:@"userId"];
    if(requiredDisposeCompletionTime.length){
        [parameters setObject:R(requiredDisposeCompletionTime) forKey:@"requiredDisposeCompletionTime"];
    }
    return [self POSTWithURLString:@"/api/public/event-process/assign/assignToUser" parameters:parameters success:success failure:fail];
}

+(NSURLSessionDataTask *)POSTWorkingAssignToDeptWithAssignTaskId:(NSString *)assignTaskId
                                                          deptId:(NSString *)deptId
                                   requiredDisposeCompletionTime:(NSString *)requiredDisposeCompletionTime
                                                         success:(LZTResponseSuccess)success
                                                            fail:(LZTResponseFailure)fail{
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:R(assignTaskId) forKey:@"assignTaskId"];
    [parameters setObject:R(deptId) forKey:@"deptId"];
    if(requiredDisposeCompletionTime.length){
        [parameters setObject:R(requiredDisposeCompletionTime) forKey:@"requiredDisposeCompletionTime"];
    }
    return [self POSTWithURLString:@"/api/public/event-process/assign/assignToDept" parameters:parameters success:success failure:fail];
}

+(NSURLSessionDataTask *)GETEventStateSuccess:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail{
    return [self GETWithURLString:@"/api/public/event/getEventStates" parameters:nil success:success failure:fail];
}
@end
